<?php 
require "vuelta.config.php";

$db = Vuelta::get_database_connection();

$activated = false;

function activate($user, $con){
    $activate_query="UPDATE account SET activated='1' WHERE email='$user'";
    if($con->query($activate_query)) return true;
}


if(isset($_GET['act'])){
  $act = $_GET['act'];
  $query = "SELECT * FROM account";

  $result = $db->query($query);
  while($row = mysql_fetch_array($result)){
    print "\n";
    if(md5($row['email']) == $act){
      $activated = activate($row['email'], $db);
    }
  }
}
$db->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Vuelta Tourspel - Account activatie</title>

  <link rel="stylesheet" type="text/css" href="css/generic.css" />
  <?php Site::css('header');?>
</head>

<body>
  <?php Site::load('header');?>
  <?php if($activated) { ?>
  <p> Account succesvol geactiveerd! </p>
  <?php } else { ?> <p>activatie link is niet correct of niet aanwezig</p>
  <?php } ?>
</body>
</html>



